﻿using System;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YJKRevitCode.ElmentSearchUtility.LinkDocumentSuite;

namespace YJKRevitCode.SampleAndTest
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	public class CmdOfViewLimit : IExternalCommand
	{
		public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
		{
			UIApplication application = commandData.Application;
			Application application2 = application.Application;
			UIDocument activeUIDocument = application.ActiveUIDocument;
			Document document = activeUIDocument.Document;
			FilteredElementCollectorLinkDocument filteredElementCollectorLinkDocument = new FilteredElementCollectorLinkDocument(document);
			XYZ xyz = new XYZ(123.659565909106, 68.4384532544525, 13.3);
			XYZ xyz2 = new XYZ(-119.122586321865, -66.0759824410856, 0.0);
			Outline outline = new Outline(xyz2, xyz);
			BoundingBoxIsInsideFilter input = new BoundingBoxIsInsideFilter(outline);
			filteredElementCollectorLinkDocument.OfCalss(typeof(Wall));
			filteredElementCollectorLinkDocument.AddViewLimit(input);
			filteredElementCollectorLinkDocument.ToBeans();
			return Autodesk.Revit.UI.Result.Succeeded;
		}
	}
}
